using System;
using System.Collections.Generic;
using System.Text;
using System.Drawing;

namespace Genetic_Tetris
{
    public class Piece
    {
        public enum PieceType
        {
            I = 0,
            J = 1,
            L = 2,
            O = 3,
            S = 4,
            T = 5,
            Z = 6

        }

        PieceType type;

        public PieceType Type
        {
            get { return type; }
            set { type = value; }
        }
        Point[] blocks = new Point[4];
        int rotation;

        public int Rotation
        {
            get { return rotation; }
            set
            {
                rotation = value;
            }
        }

        public Point[] Blocks
        {
            get { return blocks; }
            set { blocks = value; }
        }

        public void RotateLeft()
        {
            //trickery to translate to origin, rotate, then translate back
            Piece tempPiece = new Piece();
            for (int i = 0; i < blocks.Length; i++)
            {
                tempPiece.Blocks[i].X = (this.Blocks[i].Y - this.Blocks[0].Y) + this.Blocks[0].X;
                tempPiece.Blocks[i].Y = (this.Blocks[0].X - this.Blocks[i].X) + this.Blocks[0].Y;
            }
            this.Blocks = tempPiece.Blocks;



            switch (this.Type)
            {
                case PieceType.I:



                    break;
                case PieceType.J:
                    break;
                case PieceType.L:
                    break;
                case PieceType.O:
                    break;
                case PieceType.S:
                    break;
                case PieceType.T:
                    break;
                case PieceType.Z:
                    break;
                default:
                    break;
            }


















            rotation--;
            rotation = rotation % 4;


        }

        public void RotateRight()
        {
            for (int i = 0; i < blocks.Length; i++)
            {
                Point temp = blocks[i];
                blocks[i] = new Point(-temp.Y, temp.X);
            }
            rotation++;
            rotation = rotation % 4;

        }

    }
}
